//
//  PHStatus.swift
//  PHWeibo
//
//  Created by 潘荟 on 16/7/23.
//  Copyright © 2016年 BAT. All rights reserved.
/// <#Description#>

import UIKit

class PHStatus: NSObject {
    
    // MARK: - 模型属性
    var created_at: String?
    var id: Int64 = 0
    var text: String?
    var source: String?
    var user: PHUser?
    
    //  转发微博
    var retweeted_status:PHStatus?
    
    init(dict: [String : AnyObject]) {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    
    //当前类不知道user属性十个模型,所以需要程序员自己重写setValueforKey方法
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            guard let v = value as? [String : AnyObject] else {
                return
            }
            user = PHUser(dict: v)
        }else if key == "retweeted_status"{
            guard let v = value as? [String : AnyObject] else {
                return
            }
            retweeted_status = PHStatus(dict: v)
            
        }else {
            super.setValue(value, forKey: key)
        }
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }


}
